package cn.summit.config;

import cn.summit.spring.SpringContextUtil;
import cn.summit.springGlobalHandler.GlobalBaseController;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;

/**
 * @author summit
 * @since 2020/11/9 10:33
 */
@Configuration
@AutoConfigureBefore(ErrorMvcAutoConfiguration.class)
@ConditionalOnClass(DispatcherServlet.class)
public class SpringConfig {

    @Bean
    public SpringContextUtil springContextUtil() {
        return new SpringContextUtil();
    }

    @Bean
    public GlobalBaseController globalBaseController() {
        return new GlobalBaseController();
    }
}
